<?php
	session_start();

	require_once('../../lib/'.'BaseDir.inc.htm');
	require_once (EIU_LIB.'View.class.htm');
	require_once('../../lib/'.'DBCommon.class.htm');
	
	//$q = "SELECT i.`ID`,i.`CostCode` FROM `io_tbl` as i INNER JOIN `room_tbl` as r ON(i.`RoomID_Input`=r.`RoomID`)INNER JOIN `block_tbl` as b ON (r.`BlockID`=b.`BlockID`) INNER JOIN `room_tbl` as r1 ON(i.`RoomID_Out`=r1.`RoomID`)INNER JOIN `block_tbl` as b1 ON (r1.`BlockID`=b1.`BlockID`) WHERE i.`isDeleted`=0 and r.`isDeleted`=0 and r1.`isDeleted`=0 and b.`isDeleted`=0 and b1.`isDeleted`=0 ORDER BY i.`ID` DESC";
	$q = "SELECT `ID`,`CostCode` FROM `io_tbl` WHERE `isDeleted` = 0 ORDER BY `ID` DESC";

	$oDB = new DBCommon();
	$conn =  $oDB->stl_openConn();
	
	$rs = $oDB->stl_db_select($q, $conn);
	
	$i = 0;
	if(is_array($rs)){
		foreach($rs as $key=>$value){
			$data1['ID'] = $rs[$key]->ID;			
			$data1['CostCode'] = $rs[$key]->CostCode;
			$arr["Result"][$i] = $data1;
			$i++;
		}
		echo json_encode($arr);
	}else{
		echo "NG";
	}

	$oDB->stl_closeConn($conn);

?>
